import type { SeatForm, SeatQuery, SeatVO } from './model';

import type { ID, IDS, PageResult } from '#/api/common';

import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

/**
 * 分页查询天润融通呼叫坐席列表
 * @param params
 * @returns 天润融通呼叫坐席列表
 */
export function seatPage(params?: SeatQuery) {
  return requestClient.get<PageResult<SeatVO>>('/trrt/seat/page', { params });
}

/**
 * 查询天润融通呼叫坐席列表
 * @param params
 * @returns 天润融通呼叫坐席列表
 */
export function seatList(params?: SeatQuery) {
  return requestClient.get<SeatVO[]>('/trrt/seat/list', { params });
}

/**
 * 导出天润融通呼叫坐席列表
 * @param params
 * @returns 天润融通呼叫坐席列表
 */
export function seatExport(params?: SeatQuery) {
  return commonExport('/trrt/seat/export', params ?? {});
}

/**
 * 查询天润融通呼叫坐席详情
 * @param id id
 * @returns 天润融通呼叫坐席详情
 */
export function seatInfo(id: ID) {
  return requestClient.get<SeatVO>(`/trrt/seat/${id}`);
}

/**
 * 新增天润融通呼叫坐席
 * @param data
 * @returns void
 */
export function seatAdd(data: SeatForm) {
  return requestClient.postWithMsg<void>('/trrt/seat', data);
}

/**
 * 更新天润融通呼叫坐席
 * @param data
 * @returns void
 */
export function seatUpdate(data: SeatForm) {
  return requestClient.putWithMsg<void>('/trrt/seat', data);
}

/**
 * 更新天润融通呼叫坐席状态
 * @param data
 * @returns void
 */
export function seatUpdateStatus(data: SeatForm) {
  return requestClient.putWithMsg<void>(`/trrt/seat/changeStatus`, data);
}

/**
 * 为用户绑定天润融通坐席
 * @param data
 * @returns void
 */
export function seatBindUser(data: SeatForm) {
  return requestClient.putWithMsg<void>(`/trrt/seat/bindUser`, data);
}

/**
 * 删除天润融通呼叫坐席
 * @param id id
 * @returns void
 */
export function seatRemove(id: ID | IDS) {
  return requestClient.deleteWithMsg<void>(`/trrt/seat/${id}`);
}

/**
 * 获取当前账户下可用的坐席账号
 */
export function seatGetAvailable() {
  return requestClient.get<SeatVO>(`/trrt/seat/getAvailableSeat`);
}
